package com.crm.system.controller.systemManager;

import com.crm.common.model.DataResponse;
import com.crm.common.model.DhResponse;
import com.crm.common.model.Enum.ResponseCodeEnum;
import com.crm.model.entity.systemManager.SysParameterSetting;
import com.crm.system.service.systemManager.ParameterSettingService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 系统设置controller
 * @Author:chaifuyou
 * @Date: 2021/4/21 10:08
 */
@RestController
@RequestMapping("/systemParameterSetting")
@Slf4j
public class ParameterSettingController {
    @Autowired
    private ParameterSettingService parameterSettingService;

    /***
     * @Description: 新增/更改系统设置
     * @Author: chaifuyou
     * @Date: 2021/4/21 10:15
     */
    @PostMapping("/systemParameterSetting")
    public DataResponse systemParameterSetting(@RequestBody SysParameterSetting sysParameterSetting){
        parameterSettingService.systemParameterSetting(sysParameterSetting);
        return new DhResponse(ResponseCodeEnum.OK.getResponseCode());
    }

    /***
     * @Description: 查询系统设置
     * @Author: chaifuyou
     * @Date: 2021/4/21 10:50
     */
    @GetMapping("/selectSystemParameterSetting")
    public DataResponse selectSystemParameterSetting(){
        SysParameterSetting result = parameterSettingService.selectSystemParameterSetting();
        return new DhResponse(ResponseCodeEnum.OK.getResponseCode(),result);
    }
}
